#!/usr/bin/env python
#-*- coding: utf-8 -*-
#
# Copyright 2013 Antoine Drouin (poinix@gmail.com)
#
# This file is part of PAT.
#
#    PAT is free software: you can redistribute it and/or modify
#    it under the terms of the GNU General Public License as published by
#    the Free Software Foundation, either version 3 of the License, or
#    (at your option) any later version.
#
#    PAT is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU General Public License for more details.
#
#    You should have received a copy of the GNU General Public License
#    along with PAT.  If not, see <http://www.gnu.org/licenses/>.
#

"""
 Demonstrates the low level interface for the planar VTOL dynamic model
"""

import numpy as np
import scipy.integrate
import matplotlib.pyplot as plt

import pat.vehicles.rotorcraft.dynamic_model_planar_simple as dm

p = dm.Param()

Xe, Ue = dm.trim(p)

time = np.arange(0., 1., 0.01)
X = scipy.integrate.odeint(dm.dyn, Xe, time, args=(Ue, p, ))

plt.plot(time, X[:,dm.sv_x])
plt.show()
